﻿using Dapper;
using System;
using BCEntity.Trading.Purchase.GoodsPurchaseItem;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Trading.Purchase.GoodsPurchaseItem
{
    /// <summary>
    /// 商品采购项
    /// </summary>
    public interface IGoodsPurchaseItemData
    {
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="goodsPurchaseItemId">商品采购项Id</param>
        Task<bool> Exists(long goodsPurchaseItemId);
        /// <summary>
        /// 增加商品采购项
        /// </summary>
        /// <param name="entity">商品采购项信息</param>
        Task<GoodsPurchaseItemEntity> Add(GoodsPurchaseItemEntity entity);
        /// <summary>
        /// 更新商品采购项
        /// </summary>
        /// <param name="entity">商品采购项信息</param>
        Task<GoodsPurchaseItemEntity> Update(GoodsPurchaseItemEntity entity);
        /// <summary>
        /// 删除商品采购项
        /// </summary>
        /// <param name="goodsPurchaseItemId">商品采购项Id</param>
        Task<bool> Delete(long goodsPurchaseItemId);
        /// <summary>
        /// 获取商品采购项
        /// </summary>
        /// <param name="goodsPurchaseItemId">商品采购项Id</param>
        Task<GoodsPurchaseItemEntity> GetEntity(long goodsPurchaseItemId);
        /// <summary>
        /// 获取商品采购项列表
        /// </summary>
        /// <param name="adminId">创建人Id</param>
        /// <param name="hasTask">已生成采购任务</param>
        Task<IEnumerable<GoodsPurchaseItemEntity>> GetList(long adminId,bool? hasTask);
        /// <summary>
        /// 获取商品采购项分页列表
        /// </summary>
        /// <param name="categoryName">商品分类名称</param>
        /// <param name="goodsName">商品名称</param>
        /// <param name="sku">商品SKU</param>
        /// <param name="vendorName">供应商名称</param>
        /// <param name="adminName">创建人姓名</param>
        /// <param name="adminId">创建人Id</param>
        /// <param name="hasTask">已生成采购任务</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        Task<(IEnumerable<GoodsPurchaseItemEntity>, int)> Query(string categoryName,string goodsName,string sku,string vendorName, string adminName,long? adminId,int? vendorId, bool? hasTask, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
        #endregion  成员方法
        /// <summary>
        /// 修改已生成采购单
        /// </summary>
        /// <param name="goodsPurchaseItemId">商品采购项Id</param>
        /// <returns></returns>
        Task<bool> UpdateCreatedTask(long goodsPurchaseItemId);
        /// <summary>
        /// 获取采购项存在的供应商列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<GoodsPurchaseItemEntity>> GetPurchaseItemsVendorList();
    }


}